cmake_minimum_required(VERSION 3.16)
project(frpc_wfclient C CXX)
set(PROJECT_NAME frpc_wfclient )

set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
#set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /std:c++20")

set(project_root $ENV{CODE_DIR}/frpc_wfclient)


find_package(OpenSSL REQUIRED)
#find_package(workflow REQUIRED CONFIG HINTS $ENV{CODE_DIR}/workflow)
if(WIN32)
set(CPPBASE_LIB $ENV{CODE_DIR}/cppbase/build/Debug/cppbase.lib)
set(Filestore_LIB $ENV{CODE_DIR}/filestore/build/Debug/filestore.lib)
set(Protobuf_LIBRARIES $ENV{CODE_DIR}/protobuf/install/lib/libprotobufd.lib)
set(WORKFLOW_LIB workflow ws2_32 wsock32 OpenSSL::SSL OpenSSL::Crypto)
set(CMAKE_C_FLAGS   "${CMAKE_C_FLAGS}   /MP /wd4200")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP /wd4200 /Zc:__cplusplus /std:c++20")
elseif(UNIX)
find_library(LIBRT rt)
set(WORKFLOW_LIB workflow ${LIBRT})
set(CPPBASE_LIB $ENV{CODE_DIR}/cppbase/build/libcppbase.a)
set(Protobuf_LIBRARIES /usr/local/lib/libprotobuf.a)
endif()
#find_package(Protobuf CONFIG REQUIRED)

link_directories(C:\\Users\\Y\\Documents\\code\\workflow\\_lib\\Debug)

include_directories(
${project_root}/src 
$ENV{CODE_DIR}/cppbase

if(WIN32)
$ENV{CODE_DIR}/protobuf/install/include
$ENV{CODE_DIR}/workflow/_include
$ENV{CODE_DIR}/filestore/
$ENV{CODE_DIR}\\libevent-2.1.12\\install64\\include
elseif(UNIX)
/usr/local/include #protobuf include files
endif()
${OPENSSL_INCLUDE_DIR} 

)

set(CMAKE_BUILD_TYPE "Debug")

ADD_SUBDIRECTORY(src)

file(GLOB testclient_SRCS
     "./test_client/*.cpp"
)

#aux_source_directory(. frpcserver_SRCS)

add_executable(test_c 
${testclient_SRCS}
)
find_library(EVENT_LIB event_core.lib C:\\Users\\Y\\Documents\\code\\libevent-2.1.12\\install64\\lib)
set(target_list  "test_c")

foreach(_var ${target_list})
TARGET_LINK_LIBRARIES(${_var}
${WORKFLOW_LIB}
${CPPBASE_LIB}
#${Protobuf_LIBRARIES}
message
wf_task
${Filestore_LIB}
${EVENT_LIB}
channel
"C:\\Program Files (x86)\\Windows Kits\\10\\Lib\\10.0.19041.0\\um\\x64\\Iphlpapi.lib"
 )
endforeach()





#target_sources(grpc_server PRIVATE ${gserver_SRCS})



